﻿using System.Linq.Expressions;

namespace FastCode
{
    public class Msg
    {
        public int Code { get; set; }

        public object? Data { get; set; }
        public string? Message { get; set; }

        public static Msg Success(object? data = null, string message = "")
        {
            return new Msg
            {
                Code = 200,
                Message = message,
                Data = data
            };
        }

        public static Msg Error(string message, string? details = null)
        {
            return new Msg
            {
                Code = 400,
                Message = message,
                Data = details != null ? new { Details = details } : null
            };
        }
    }
}
